import { Animation } from "cc";
import { State } from "../../Base/State";
import { StateMachine, getInitParamTrigger } from "../../Base/StateMachine";
import { EnemyManager } from "../Enemy/EnemyManager";
import { StateTypeEnum } from "../../Common";

export class BulletStateMachine extends StateMachine {
    entity: EnemyManager
    init(entity: EnemyManager) {
        this.animationComponent = this.node.addComponent(Animation)
        this.entity = entity
        this.initParam()
        this.initState()
    }

    initParam() {
        this.params.set(StateTypeEnum.none, getInitParamTrigger())
    }

    initState() {
        this.stateMachines.set(StateTypeEnum.none, new State(this, this.entity.type, StateTypeEnum.none))
    }

    run() {

        switch (this.currencyState) {
            case this.stateMachines.get(StateTypeEnum.none):
                if (this.params.get(StateTypeEnum.none).value) {
                    this.currencyState = this.stateMachines.get(StateTypeEnum.none)
                }
                break;
            default:
                this.currencyState = this.stateMachines.get(StateTypeEnum.none)
                break;
        }

    }

}